# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=air
pkgver=1.49.0
pkgrel=0
pkgdesc="Live reload for Go apps"
url="https://github.com/cosmtrek/air"
arch="all"
license="GPL-3.0-or-later"
makedepends="go"
source="$pkgname-$pkgver.tar.gz::https://github.com/cosmtrek/air/archive/refs/tags/v$pkgver.tar.gz"
options="!check" # failed to build; outdated, broken tests

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	mkdir -v build
	local goldflags="
	-X main.airVersion=$pkgver
	-X main.goVersion=$(go env GOVERSION | sed 's/^go//')
	"
	go build -v -o build -ldflags "$goldflags" .
}

package() {
	install -Dm755 build/$pkgname -t "$pkgdir"/usr/bin
}

sha512sums="
ce0404dae1c6ff491d2d5e9ee8c2085e6bcb06fd9125477b0a0e6db243f32797d96fcce438fc7bd1d1c0794c590070669e41bff9f4a667f9ebaf1c1ef404541b  air-1.49.0.tar.gz
"
